<?php
require_once "header_editor.php"; 
require_once "db.php"; 
require_once "forms.php"; 

get_database_connection();

$object_id = $_SESSION["object_id"];
?>

<script type="text/javascript">
function load_page(id) {
  $("#preview_page").html("");
  $("#preview_page").load("preview_page.php?id=" + id);
}
</script>

<?php
// Getting the object_title

?>

<h2> Pre-visualizando objeto SCORM: <?php echo $_SESSION["object_title"]; ?> </h2>

<div class="c2"> 
<ol>
  <?php 
  // Getting the slides from the database.
  $sql = "SELECT * FROM slides 
          WHERE object_id = $object_id  
          ORDER BY position ASC";
  $query = mysql_query($sql);
  while ($data = mysql_fetch_assoc($query)) {
  ?>
    <li onclick="load_page(<?php echo $data["id"]; ?>);"> 
      <a href="#"> <?php echo $data["title"]; ?> </a>
    </li>
  <?php } ?>
</ol>
</div>

<div id="preview_page" class="c3" style="border: 1px solid #C3C3C3; padding: 15px; overflow:auto;">
</div>

<?php
require_once "footer.php";
?>

